<?php
declare (strict_types = 1);

namespace app\shop\controller;

use app\common\service\CountryService\CountryService;
use app\Normal;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;

/**
 * 国家管理
 * @Group("Country")
 * @Middleware({shopMiddileware::class})
 */
class Country extends \app\BaseShopController
{
    /**
     * 国家列表
     * @Route("CountryLists",method="GET")
     * @return void
     */
    public function CountryLists(){
        $result = callApi(CountryService::class, 'CountryLists',$this->_all_data);
        return apiResponse($result);
    }

    /**
     * 国家详情
     * @Route("CountryDetails/:id",method="GET")
     * @return void
     */
    public function CountryDetails(){
        $result = callApi(CountryService::class, 'CountryDetails',$this->_all_data);
        return apiResponse($result);
    }

    /**
     * 修改国家详情
     * @Route("editCountry",method="PUT")
     * @return void
     */
    public function editCountry(){
        $result = callApi(CountryService::class, 'editCountry',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'修改国家ID为【'.$this->_all_data['id'] . '】的详情','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
}